import { loadPlugin, loadPluginFn } from '../../app/config/loadplugin.config.js';
import authService from '../../app/resolves/authService.js';
import getCourseList from '../../course/resolves/getCourseList.js';


import entrysettingHtml from 'ngtemplate!html!../../../tpls/entry/entry.setting.html';
import entrydatasettingHtml from 'ngtemplate!html!../../../tpls/entry/entry.datasetting.html';
import entryimportHtml from 'ngtemplate!html!../../../tpls/entry/entry.import.html';
import entrybiblistHtml from 'ngtemplate!html!../../../tpls/entry/entry.biblist.html';
import entryregisterlistHtml from 'ngtemplate!html!../../../tpls/entry/entry.registerlist.html';


/**
 * EntryRouter - config
 * 报名服务模块路由设置
 */
EntryRouter.$inject = ['$stateProvider', '$urlRouterProvider', '$httpProvider', '$locationProvider', '$ocLazyLoadProvider'];
function EntryRouter($stateProvider, $urlRouterProvider, $httpProvider, $locationProvider, $ocLazyLoadProvider) {

	//set router
    $stateProvider

		// 报名设置
		.state('dashboard.race.entrysetting', {
		    url: '/entry/setting',
		    data: { 
		        pageTitle: '报名设置' 
		    },
		    templateUrl: entrysettingHtml,
		    controller: 'EntrySettingController as vm',
		    resolve: {
		    	authService: authService,
		    	getCourseList: getCourseList,
		    	loadPlugin: loadPluginFn([loadPlugin.multiswitch, loadPlugin.jscolorui, loadPlugin.moment, loadPlugin.icheck])
		    }
		})

		// 报名资料设置
		.state('dashboard.race.entrydatasetting', {
		    url: '/entry/entrydatasetting',
		    data: { 
		        pageTitle: '报名设置' 
		    },
		    templateUrl: entrydatasettingHtml,
		    controller: 'EntryDataSettingController as vm',
		    resolve: {
		    	authService: authService,
		    	getCourseList: getCourseList,
		    	loadPlugin: loadPluginFn([loadPlugin.icheck, loadPlugin.jqueryui, loadPlugin.metismenu, loadPlugin.slimscroll])
		    }
		})

		// 选号区间导入
		.state('dashboard.race.entryimport', {
		    url: '/entry/entryimport',
		    data: { 
		        pageTitle: '报名设置' 
		    },
		    templateUrl: entryimportHtml,
		    controller: 'EntryImportController as vm',
		    resolve: {
		    	authService: authService
		    }
		})

		// 选手号列表
		.state('dashboard.race.entrybiblist', {
		    url: '/entry/entrybiblist',
		    data: { 
		        pageTitle: '报名设置' 
		    },
		    templateUrl: entrybiblistHtml,
		    controller: 'EntryBibListController as vm',
		    resolve: {
		    	authService: authService,
		    	loadPlugin: loadPluginFn(loadPlugin.dataTables)
		    }
		})

		// 已报名选手列表
		.state('dashboard.race.entryregisterlist', {
		    url: '/entry/entryregisterlist',
		    data: { 
		        pageTitle: '报名设置' 
		    },
		    templateUrl: entryregisterlistHtml,
		    controller: 'EntryRegisterListController as vm',
		    resolve: {
		    	authService: authService,
		    	getCourseList: getCourseList,
		    	loadPlugin: loadPluginFn(loadPlugin.dataTables)
		    }
		})

}

export default EntryRouter; 